﻿using System;
using System.Text;
using System.Collections.Generic;
using System.Linq;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using MVCPets.Helpers;

namespace MVCPets.Tests.Helpers
{
  [TestClass]
  public class PasswordHelperTests
  {
    [TestMethod]
    public void Test_GeneratePassword()
    {
      Assert.IsTrue(PasswordGenerator.GeneratePassword(6, PasswordGenerator.PasswordType.NoDuplicates).Length == 6);
      Assert.IsTrue(PasswordGenerator.GeneratePassword(6, PasswordGenerator.PasswordType.DuplicatesAllowed).Length == 6);
    }

    [TestMethod, ExpectedException(typeof(PasswordException))]
    public void Test_GeneratePassword_Fails()
    {
      Assert.IsTrue(PasswordGenerator.GeneratePassword(Int32.MaxValue, PasswordGenerator.PasswordType.NoDuplicates).Length == 6);
    }
  }
}
